package com.hdoit.apollo.logical.stock.dao.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.hdoit.apollo.logical.stock.dao.IOutStockDao;
import com.hdoit.apollo.logical.stock.mapper.OutStockMapper;
import com.hdoit.apollo.logical.stock.model.OutStock;
import com.hdoit.apollo.logical.viewmodel.stock.OutStockSearch;
import com.tennetcn.data.dao.base.ISqlExpression;
import com.tennetcn.data.dao.base.impl.SuperDao;
import com.tennetcn.data.message.PagerModel;
import com.tennetcn.data.utils.SqlExpressionFactory;
/**
 * @author      humaoshu
 * @email       
 * @createtime  2018年04月02日 11:55:53
 * @comment
 */
@Component
public class OutStockDaoImpl extends SuperDao<OutStock> implements IOutStockDao{
	@Autowired
	private OutStockMapper outStockMapper;
	@Override
	public OutStock queryModelById(String key) {
		return outStockMapper.queryModelById(key);
	}
	@Override
	public boolean deleteOsutStockByKey(String outStockId) {
		ISqlExpression sqlExpression = SqlExpressionFactory.createExpression();
		sqlExpression.addBody("delete from",OutStock.class)
					.andWhere("outStockId=#{outStockId}")
					.setParam("outStockId", outStockId);
		return delete(sqlExpression)>=0;
	}
	
	@Override
	public List<OutStock> queryListBySearch(OutStockSearch search) {
		return outStockMapper.queryListBySearch(search);
	}
	
	@Override
	public List<OutStock> queryListMPForReturn(OutStockSearch search,
			PagerModel pagerModel) {
		
		return outStockMapper.queryListMPForReturn(search,pagerModel);
	}
	
	@Override
	public OutStock queryModelBySee(String key) {
		
		return outStockMapper.queryModelBySee(key);
	}
	@Override
	public int queryCountMPForReturn(OutStockSearch search) {
		
		return outStockMapper.queryCountMPForReturn(search);
	}
	@Override
	public boolean deleteOutStockData(String billingId) {
		
		return outStockMapper.deleteOutStockData(billingId)>=0;
	}
	@Override
	public boolean deleteOutStockShowData(String billingId) {
		
		return outStockMapper.deleteOutStockShowData(billingId)>=0;
	}
	@Override
	public boolean deleteOutStockCollocationData(String billingId) {
		
		return outStockMapper.deleteOutStockCollocationData(billingId)>=0;
	}

}